package com.sanyou.springcloud.ribbon;

import com.netflix.client.config.IClientConfig;
import com.netflix.loadbalancer.ServerList;
import org.springframework.cloud.client.discovery.DiscoveryClient;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 整合类 ，不能跟启动引导类在同一个目录或者子目录下
 *
 * @author zhuoziyang
 * @date 2021/9/26 7:43
 */
@Configuration
public class RibbonDefaultConfiguration {

    @Bean
    public ServerList serverList(DiscoveryClient discoveryClient, IClientConfig iClientConfig) {
        SpringCloudServerList springCloudServerList = new SpringCloudServerList(discoveryClient);
        springCloudServerList.initWithNiwsConfig(iClientConfig);
        return springCloudServerList;
    }

}
